package com.example.demo.sub.service;

import com.example.demo.enums.StatusEnum;
import com.example.demo.sub.RedisStop;
import com.example.demo.task.service.TaskSchedulerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * @Auther Created by l.wang on 2019/1/18.
 */
@Service
public class RedisStopImpl implements RedisStop {

    @Autowired
    private TaskSchedulerService taskSchedulerService;

    @Override
    public void stop(String key) {
        StatusEnum statusEnum = taskSchedulerService.stopTaskScheduler(key);
        if (!StringUtils.isEmpty(statusEnum.getKey())){
            //修改数据库为停止状态

        }
    }

    @Override
    @Cacheable(value = "abc",key = "#key")
    public String stops(String key) {
        return "fdsasdfdsa";
    }

}
